<template>
  <div>
    <input type="text" v-if="isShowInput" ref="ipt" />
    <button @click="showInput">点击搜索</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isShowInput: false,
    }
  },
  methods: {
    showInput() {
      this.isShowInput = true
      console.log(this.$refs.value)
      this.$nextTick(() => {
        this.$refs.ipt.focus()
      })
    },
  },
}
</script>

<style></style>
